Wrap fileDescriptorRatioGauge which breaks in java9#17
Wrap fileDescriptorRatioGauge which breaks in java9#17jhaals wants to merge 3 commits intospotify:masterfrom
Conversation
Java9 fails with `InaccessibleObjectException` which causes all metric reporting to fail. This is a new exception in java9 so we can't catch it in Java8, simply return 0 if exception is thrown. This is tested in java8/java9 ``` java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @385c9627 ```
|
Hey, Any way this can be detected before we are polling the Gauge, so that we don't have to register the gauge at all if it's not supported? Maybe try to poll it once during registration? |
|
Hi, |
|
@jhaals proper fix would be appreciated if you have the time :) |
|
@udoprog I can wrap the whole |
|
This was merged into dropwizard/metrics 12 days ago dropwizard/metrics#1236 |
|
Hm, that's an interesting approach. I'd think it would be preferably not to register anything if the operation is not supported. Apparently we can do an |
|
I upgraded the metrics library for exactly this issue in #30, sorry I missed this PR when making that |
|
No worries @mattnworb, your PR is preferred 👍 |
Java9 fails with
InaccessibleObjectExceptionwhich causes all metricreporting to fail. This is a new exception in java9 so we can't catch it
in Java8, simply return 0 if exception is thrown. This is tested in
java8/java9